using System;
using System.ComponentModel;
using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Views.Grid;

namespace Comteck.Winforms.Forms {
  /// <summary>
  /// 对话框基类
  /// </summary>
  public partial class FrmDialogBase : FrmBase {

    #region properties

    /// <summary>
    /// 数据查询模式
    /// </summary>
    [Browsable(false)]
    public virtual EnumSearchDataMode SearchMode { get; set; } = EnumSearchDataMode.Local;

    /// <summary>
    /// 默认的选择类型
    /// </summary>
    [DefaultValue(EnumSelectType.Multi)]
    [DXCategory("功能扩展")]
    [Description("查询支持的类型：单选或者多选，默认是多选")]
    public virtual EnumSelectType SelectType { get; set; } = EnumSelectType.Multi;

    /// <summary>
    /// 是否双击产生
    /// </summary>
    protected bool IsDoubleClick { get; set; } = false;

    /// <summary>
    /// 显示作废的机构
    /// </summary>
    public bool ShowDisable { get; set; } = false;

    /// <summary>
    /// 是否有商品编码唯一的限制
    /// </summary>
    public bool IsGoodsCodeUniqueLimit { get; set; } = false;

    #endregion

    #region methods

    /// <summary>
    /// 设置grid的选择模式
    /// </summary>
    protected void SetGridViewSelectMode(GridView gridView) {
      gridView.OptionsSelection.MultiSelect = this.SelectType == EnumSelectType.Multi;
    }

    #endregion

    #region ctor

    /// <summary>
    /// 
    /// </summary>
    public FrmDialogBase() {
      InitializeComponent();
    }

    #endregion

    #region form load

    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void FrmDialogBase_Load(object sender, EventArgs e) {

    }

    #endregion

  }
}
